/* -*- mode: js2 -*- */
/**
 * @fileOverview 根据高度对模型剖切的示例
 * @name NewApi20180511.js
 * @author Rashawn Zhang <namy.19@gmail.com>
 */

BimsopNamespace("Bimsop.Extension");

Bimsop.Extension.NewApi20180511 = function(viewer, options) {
  Bimsop.Viewing.Extension.call(this, viewer, options);

  var _self = this;

  var _panel = null;

  var _interval = null;

  _self.load = function() {
    console.log("Bimsop.Extension.NewApi20180511 loaded");
    console.log("API: viewer.getFloorInfo");
    console.log(oViewer.getFloorInfo());

    console.log("API: viewer.setThemingColor");
    oViewer.setThemingColor(88, new THREE.Color(1, 0, 0));
    oViewer.setThemingColor(
      181,
      new THREE.Color(1, 0, 0),
      oViewer.currentModel
    );

    console.log("API: viewer.clearThemingColor");
    oViewer.clearThemingColors(181);

    console.log("API: viewer.sectionByY");
    oViewer.sectionByY(2);
    console.log("API: viewer.sectionByY disable");
    oViewer.sectionByY(false);

    console.log("API: viewer.setNodeTransparent");
    oViewer.setNodeTransparent(168, oViewer.currentModel, true);
    console.log("API: viewer.setNodeTransparent set back");
    oViewer.setNodeTransparent(168, oViewer.currentModel, false);
    return true;
  };

  _self.unload = function() {
    console.log("Bimsop.Extension.NewApi20180511 unloaded");
    return true;
  };
};

Bimsop.Extension.NewApi20180511.prototype = Object.create(
  Bimsop.Viewing.Extension.prototype
);

Bimsop.Extension.NewApi20180511.prototype.constructor =
  Bimsop.Extension.NewApi20180511;

Bimsop.Viewing.theExtensionManager.registerExtension(
  "Bimsop.Extension.NewApi20180511",
  Bimsop.Extension.NewApi20180511
);
